package com.itheima.io1.mytest;

import java.io.*;

/**
 * @author zhangbaiyan
 * @date 2024-09-21 15:56
 * @description:
 * @version:
 */
public class test6 {
    public static void main(String[] args) throws IOException {
        //1.把文件中的数字读取到内存中
        BufferedReader br = new BufferedReader(new FileReader("count.txt"));
        String line = br.readLine();
        int count = Integer.parseInt(line);
        //表示当前软件又运行了一次
        count++;
        //判断
        if (count > 3) {
            System.out.println("软件已过期，请联系管理员");
            System.exit(0);
        }
        System.out.println("软件还剩" + (3 - count) + "次使用机会");
        br.close();
        BufferedWriter bw = new BufferedWriter(new FileWriter("count.txt"));
        bw.write(count + "");
        bw.close();
    }
}
